{extend name="public/base"/}
{block name="body"}
<style>
    .mui-row.mui-fullscreen>[class*="mui-col-"] {
        height: 100%;
    }

    .mui-col-xs-3,
    .mui-col-xs-9 {
        overflow-y: auto;
        height: 100%;
    }

    .mui-segmented-control .mui-control-item {
        line-height: 50px;
        width: 100%;
    }

    .mui-segmented-control.mui-segmented-control-inverted .mui-control-item.mui-active {
        background-color: #fff;
    }
    .mui-toast-container {
        bottom: 50%;
    }

    .mui-card .mui-control-content {
      padding: 10px;
    }

    .mui-control-content {
      height: 600px;
    }

    .mui-table-view .mui-media-object {
         line-height: 100px;
         max-width: 100px;
        height: 100px;
        width: 33.333333%
    }


    .mui-col-sm-3{
      width: 33.3333333%;
    }
    .price{
      color: #f60;
      font-size: 0.475342rem;
    }

    .mui-table-view-cell.mui-active{
        background-color: #fff
    }
    .mui-numbox{
      height: 25px;
      margin-top: 5px;
    }
    .mui-card img{
      width: 100%;      height: 100%;
    }
    .foodprice::before {

    content: '';

}
</style>
<header class="mui-bar mui-bar-nav" style="z-index:7">
      <a class=" mui-icon mui-icon-home mui-pull-left"  href="{:url('index/index/stindex')}"></a>
      <h1 class="mui-title">{$info.good_name}</h1>
      <a class="mui-icon mui-icon-contact mui-pull-right" href="{:url('index/user/index')}"></a>
</header>
<div class="mui-content"  >
  <img  src="{$info['cover_id']|get_cover='path'}" style="width:100%;max-height: 250px;" data-preview-src="" data-preview-group="{$info['id']}">
  <div class="mui-card" >
  				<div class="mui-card-header" style="display: block;" >
            {$info.good_name}
            <p>
              {$info.good_brief}
            </p>
            <p style="overflow: hidden;    margin-bottom: 15px;">
              {php}
                 $priceArr = array();
                 foreach($info['goodsrule'] as $data){
                    $priceArr[]= $data['rule_price'];
                 }
                 $minPrice = min($priceArr);

                 if(count($priceArr) > 1){
                      $minPriceHtml = "<span>".$minPrice."</span><span class='foodprice-lowest'>起</span>";
                 }else{
                    $minPriceHtml = "<span>".$minPrice."</span>";
                 }
              {/php}
            <strong class="foodprice" style="bottom: 10px;   left:15px; "><span style="color:#000;font-weight: normal;font-size:12px;">价格</span>

                                            ¥{$minPriceHtml}

            <del style="color:#666;font-size:12px;font-weight: normal;">¥{$info['goodsrule'][0]['market_price']}</del></strong>
            </p>

            <div class="mask mask-transition" style="display:none;">
                <div class="wrap">
                    <div class="container">
                        <div class="specpanel">
                            <h1>{$info['good_name']}</h1>
                            <div class="candidators">
                                <div class="candidators-group">
                                    <h2>规格</h2>
                                      {volist name="$info['goodsrule']" id="voo"  }
                                        <a href="javascript:" class="candidator {eq name='$i' value='1'}selected {/eq}" data-info="{$voo[rule_name]}|{$voo[rule_price]}|{$voo[stock]}|{$voo[weight]}" data-ruleid="{$voo[id]}">{$voo[rule_name]}</a>
                                      {/volist}
                                </div>
                                <div class="selectedresult">
                                    <p class="selectedstr">已选：{$info['goodsrule'][0]['rule_name']} <span class='stock'>库存：{$info['goodsrule'][0]['stock']}</span> <span class='weight'>重量：{$info['goodsrule'][0]['weight']}</span></p>
                                    <p class="price"><span class="yen">¥</span> <span class="now">{$info['goodsrule'][0]['rule_price']}</span> </p>
                                </div>
                                <a href="javascript:" class="cartadd" data-id="{$info['id']}" data-ruleid="{$info['goodsrule'][0]['id']}" data-dismiss="cart" data-methods="addmore" >加入购物车</a>
                                <a href="javascript:" class="close"></a>
                        </div>
                    </div>
                </div>
            </div>
          </div>
        <dd  data-ruleid="{$info['goodsrule'][0]['id']}"  data-goodid="{$info['id']}" style="     padding: 0;display: block;  min-height: 0;">
              <div class="cartbutton" style="    bottom: 5px;">
                <span>
                  <span class="entitybutton">
                    {$info['id']|getRulenumhtml}
                    {if condition="count($info['goodsrule']) gt 1 "}
                      <a href="javascript:" class="specadd cartbtn{$info['id']}"  ><span class="entityspecbutton"  >选规格</span></a>
                    {else /}

                      {eq name="$item.goodsrule[0]['stock']" value="0"}
                            <a href="javascript:"  ><span class="entityspecbutton" style="background-color: #ce4747;">已售罄</span></a>
                      {else/}
                        <a href="javascript:" class="oneaddcart cartbtn{$info['id']}" data-dismiss="cart" data-methods="addone" ><span class="mui-icon mui-icon-plus"></span></a>
                      {/eq}

                    {/if}
                  </span>
                </span>
            </div>
        </dd>
        </div>
  				<div class="mui-card-content" style="    min-height: 150px;">
  					<div class="mui-card-content-inner">

              {eq name="$info.is_timelimit" value="1"}
                {if condition="strtotime($info->startlimit) < intval(time()) && intval(time()) < strtotime($info->endlimit)"}
                  <p class="fooddescription endlimit"   data-endtime = "{$info.endlimit}" data-starttime = "{$info.startlimit}"  style="margin:3px 0;font-weight: bold;"></p>
                {elseif condition="strtotime($info->startlimit) > intval(time())"/}
                <p class="fooddescription  hidecartbtn" data-id="{$info.id}"   style="margin:3px 0;color:red">团购未开始：{$info.startlimit} —— {$info.endlimit}</p>
                {else /}
                <p class="fooddescription  hidecartbtn" data-id="{$info.id}"  style="margin:3px 0;color:red">团购已结束：{$info.startlimit} —— {$info.endlimit}</p>
                {/if}
              {/eq}

              {$info['good_desc']}
              {$info.content}
  					</div>
  				</div>

  			</div>

</div>



{include file="public/cartNav" /}
<link rel="stylesheet" type="text/css" href="__PUBLIC__/xsd/css/ext.css?v1111">


</div>
{/block}
{block name="script"}
<script type="text/javascript">
  var addUrl = "{:url('index/cart/add')}",
      minusUrl = "{:url('index/cart/minus')}",
      clearUrl="{:url('index/cart/clear')}",
      cartListUrl ="{:url('index/cart/getCartlist')}";
</script>
<script src="__PUBLIC__/xsd/js/cart.js?v=111112211211122" charset="utf-8"></script>
<script>
  $(function(){
    $(document).on('click', '.tgxd' , function(){
      var url = $(this).attr('data-url'),num = parseInt($('[data-dismiss="cartpopup"]').attr('attr-quantity'))
      console.log($('.carticon').text());
      var subscribe = '{$subscribe}';
      if(subscribe != 1){
        $.get("{:url('index/getSubscribe')}", function(data){
          if(data.value == 0){
            mui.alert('<img src="/public/images/qrcode_for_wx.jpg" style="width:100%;"><p style=" text-align: left;"><b>无法识别二维码</b><br />1、打开微信，点击‘添加朋友’<br />2、点击公众号<br />3、搜索公众号：贵阳鲜果屋<br />4、点击‘关注’，完成</p>', '请长按扫二维码关注公众号');
            return ;
          }else {
            if(num>0){
              window.location.href = url
            }else{
              mui.toast('请添加购买的商品！')
            }
          }
        })

      }else{
        if(num>0){
          window.location.href = url
        }else{
          mui.toast('请添加购买的商品！')
        }
      }
    })
  })

  $(function(){
    $('.pref-info').click(function(){
      var info=$(this).text()
      mui.alert(info, '公告', '关闭',function() {

      });
    })
  })

</script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js" charset="utf-8"></script>
<script>
    wx.config({$options|json_encode});
    wx.error(function(e){
      	console.log(e);
      });
    wx.ready(function(){
      wx.onMenuShareTimeline({
          title: "{$info.good_name}-鲜果屋",
          link: "{$crurl}",
          imgUrl: "http://www.xgw0851.com/{$info['cover_id']|get_cover='path'}",
      });
      wx.onMenuShareAppMessage({
          title: "{$info.good_name}-鲜果屋",
          desc: "{$info.good_desc}", // 分享描述
          link: "{$crurl}",
          imgUrl: "http://www.xgw0851.com/{$info['cover_id']|get_cover='path'}",

      });
    });
</script>

{/block}
